import request from '@/utils/request'

export function trainPlanList(params) {
  return request({
    url: `/eduTrainPlan/trainPlanList`,
    method: 'get',
    params
  })
}

export function trainPlanInfo(id) {
  return request({
    url: `/eduTrainPlan/info/${id}`,
    method: 'get'
  })
}

export function trainPlanDelete(id) {
  return request({
    url: `/eduTrainPlan/delete/${id}`,
    method: 'get'
  })
}

export function addTrainPlan(data) {
  return request({
    url: `/eduTrainPlan/create`,
    method: 'post',
    data
  })
}

export function updateTrainPlan(data) {
  return request({
    url: `/eduTrainPlan/update`,
    method: 'post',
    data
  })
}


export function tagList() {
  return request({
    url: `/eduTrainPlan/tagList`,
    method: 'get'
  })
}

export function categoryTreeList() {
  return request({
    url: `/frontView/page/crudQuery/eduCategory`,
    method: 'post',
    data: {
      page: 1,
      perPage: 99999
    }
  })
}

export function addTag(name) {
  return request({
    url: `/eduTrainPlan/addTag?name=${name}`,
    method: 'get'
  })
}

export function testPaperList(tags) {
  return request({
    url: `/eduTrainPlan/testPaperList?tags=${tags}`,
    method: 'get'
  })
}

export function eduCourseList(tags) {
  return request({
    url: `/eduTrainPlan/eduCourseList?tags=${tags}`,
    method: 'get'
  })
}

export function getTagQuestionNum(tag, type) {
  return request({
    url: `/eduTrainPlan/getTagQuestionNum?tag=${tag}&type=${type}`,
    method: 'get'
  })
}

export function getOfflineTrainPlans(params) {
  return request({
    url: `/eduTrainPlan/getOfflineTrainPlans`,
    method: 'get',
    params
  })
}

export function finishOfflineTrain(data) {
  return request({
    url: `/eduTrainPlan/finishOfflineTrain`,
    method: 'post',
    data
  })
}

export function getOfflineExamInfo(id) {
  return request({
    url: `/eduTrainPlan/getOfflineExamInfo/${id}`,
    method: 'get'
  })
}

export function getOfflineTrainInfo(id) {
  return request({
    url: `/eduTrainPlan/getOfflineTrainInfo/${id}`,
    method: 'get'
  })
}

export function getOfflineExamPlans(params) {
  return request({
    url: `/eduTrainPlan/getOfflineExams`,
    method: 'get',
    params
  })
}

export function finishOfflineExam(data) {
  return request({
    url: `/eduTrainPlan/finishOfflineExam`,
    method: 'post',
    data
  })
}

export function trainPlanProgress(planId) {
  return request({
    url: `/eduTrainPlan/progress/${planId}`,
    method: 'get'
  })
}

